package com.myHospital.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.myHospital.biz.DepartmentsBiz;
import com.myHospital.biz.HospitalBiz;

@Controller
public class AppiontController {
	@Autowired
	private HospitalBiz hospitalBiz;
	@Autowired
	private DepartmentsBiz departmentsBiz;
	
	//医院列表
	@RequestMapping("/hospital_list")
	public String hospital_list(Model model){
		model.addAttribute("hospitals",hospitalBiz.getAll());
		return "app/hospital_list";
	}
	
	//科室列表
	@RequestMapping("/department")
	public String department(Model model,@RequestParam(name="hid",defaultValue="0")Integer hid,@RequestParam(name="did",defaultValue="0")Integer did){
		model.addAttribute("departments",departmentsBiz.getByDetailId(hid, did));
		return "app/department_list";
		
	}
}
